<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var xhr=new XMLHttpRequest()
        console.log(xhr.readyState)
        xhr.open('get','http://localhost:3000/readystate')
        console.log(xhr.readyState)
        xhr.send();
        xhr.onreadystatechange=function(){
            console.log(xhr.readyState)
            if(xhr.readyState==4){
                console.log(xhr.responseText)
            }
        }
    </script>
</body>
</html>